<?php 
    $ch = curl_init(); 
 
    $fp=fopen('./girl1.jpg', 'w');
    curl_setopt($ch, CURLOPT_URL, "http://192.168.1.185/curl_learning/girl.jpg"); 
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60); 
    curl_setopt($ch, CURLOPT_FILE, $fp); //设置输出文件的位置，值是一个资源类型，默认为STDOUT (浏览器)。
 
    $output = curl_exec($ch); 
    $info = curl_getinfo($ch);
	// echo json_encode($info);
    fclose($fp);
 
    $size = filesize("./girl.jpg");
    if ($size != $info['size_download']) {
        echo "下载的数据不完整，请重新下载";
    } else {
        echo "下载数据完整";
    }
 
    curl_close($ch);    
?>